package com.digiwin.escloud.test.core.listener;

import org.testng.IAnnotationTransformer;
import org.testng.IRetryAnalyzer;
import org.testng.annotations.ITestAnnotation;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

/**
 * @Author yanggld
 * @Date 2020/5/6-16:13
 */
public class FailedRetryListener implements IAnnotationTransformer {
	@Override
	public void transform(ITestAnnotation iTestAnnotation, Class aClass, Constructor constructor, Method method) {
		{
			Class<? extends IRetryAnalyzer> retry = iTestAnnotation.getRetryAnalyzerClass();
			if (!FailedRetry.class.equals(retry)) {
				iTestAnnotation.setRetryAnalyzer(FailedRetry.class);
			}
		}
	}
}
